﻿#region

using System;
using System.Collections.Generic;
using System.IO;

#endregion

namespace Rnwood.SmtpServer
{
    public class Message
    {
        internal int DeferCount;

        public Message(Session session)
        {
            Session = session;
            ToList = new List<string>();
            ReceivedDate = DateTime.Now;
            DeferCount = 0;
        }

        public Message(String ToAddr, String Body )
        {
            ToList = new List<string>();
            ToList.Add(ToAddr);
            From = "admin@server.com";
            ReceivedDate = DateTime.Now;
            System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
            Data = encoding.GetBytes(Body);
        }

        public DateTime ReceivedDate { get; internal set; }

        public Session Session { get; private set; }

        public string From { get; internal set; }

        internal List<string> ToList { get; set; }

        public string[] To
        {
            get { return ToList.ToArray(); }
        }

        public byte[] Data { get; internal set; }
    }
}